package book.hadoop.ch05;

import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;

public class ConfigurationTest {
	
	@Test
	public void testReadConfigurationFromFile(){
		Configuration conf = new Configuration();
		conf.addResource(getClass().getResourceAsStream("configuration-1.xml"));
		assertThat(conf.getInt("size", 0),is(12));
		assertThat(conf.get("weight"),is("light"));
		assertThat(conf.get("size-weight"),is("12,light"));
		System.setProperty("size","14");
		assertThat(conf.getInt("size", 0),is(14));
		//assertThat(conf.get("size-weight"),is("14,light"));
	}

}
